﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MaterPageForum.Master" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="KerriganForum.Home" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<style type="text/css">

body 
{
    height:500px;
    /*background-image : url(http://localhost:2777/Images/wallpaper-182372.jpg);*/

    
    background-attachment:initial;
    background-clip:initial;
    background-color:initial;
    background-image:url(http://localhost/KerriganForum/Images/content.jpg);
    background-origin:initial;
    background-position:0 0;
    background-repeat:repeat repeat;
    padding-top:25px;   
}


    
#title
{
   padding-top:60px;
  text-align:center;
  z-index:111111;
  font-size:40px; 
    }   


    
    
#middle
{
    margin-left: 150px; 
    margin-right: 310px; 
    height:500px;
    margin-top: -51px;
    
}
    
#right
{
    float: right; 
    width: 140px; 
    background: #DDDDDD; 
    height:500px;
}

.Container
   {
       margin:auto;
       min-height:400px;
       background:#ffffff;
       max-width:500px;
       min-width:500px;
       border:solid 1px #d4d4d4;
       padding:0 20px 20px 20px;
   }
   
   .ToolBar
   {
       border:solid 1px #d4d4d4;
       padding:10px;
       margin-bottom:20px;
   }
   
   .GridContainer
   {
       background:#ECF5FB;
       min-height:500px;
       border:solid 1px #d4d4d4;
       width : 900px;
   }
   
   
   .ModalPopupBG
   {
       background-color: #8F8F8D;
       filter: alpha(opacity=50);
       opacity: 0.7;
   }
   
   .popup_Container {
       background-color:#fffeb2;
       border:2px solid #000000;
       padding: 0px 0px 0px 0px;
   }
   
   .popupConfirmation
   {
       width: 600px;
       height: 200px;
   }
   
   .popup_Titlebar {
       background: url('Images/titlebar_bg.jpg');
       height: 290px;
   }
   
   .popup_Body
   {
       padding:15px 15px 15px 15px;
       font-family:Arial;
       font-weight:bold;
       font-size:12px;
       color:#000000;
       line-height:15pt;
       clear:both;
       padding:20px;
   }
   
   .TitlebarLeft 
   {
       float:left;
       padding-left:5px;
       padding-top:5px;
       font-family:Arial, Helvetica, sans-serif;
       font-weight:bold;
       font-size:12px;
       color:#FFFFFF;
   }
   .TitlebarRight 
   {
       background:url('Images/cross_icon_normal.png');
       background-position:right;
       background-repeat:no-repeat;
       height:15px;
       width:16px;
       float:right;
       cursor:pointer;
       margin-right:5px;
       margin-top:5px;
   }
   
   .popup_Buttons
   {
       margin:10px;
   }
    

</style>
      <script language="javascript" type="text/javascript">

          function ShowEditModal(categoryId) {
              var frame = $get('IframeEdit');
              frame.src = "EditCategory.aspx?Activity=edit&ID=" + categoryId;
              $find('modalpopupEdit').show();
          }

          function ShowNewModal() {
              $find('modalpopup').show();
          }

          function EditCancelScript() {
              RefreshDataGrid();
          }
          function EditOkayScript() {
              RefreshDataGrid();
          }

          function RefreshDataGrid() {
              location.assign(location.href);
          }
          function onSuccess() {
              setTimeout(okay, 2000);
          }


          function okay() {
              window.parent.document.getElementById('ButtonEditDone').click();
//              document.getElementById('TxtBoxContent').value = "";
              document.getElementById('txtNameCategory').value = "";
          }

          function cancel() {
              window.parent.document.getElementById('ButtonEditCancel').click();
//              document.getElementById('TxtBoxContent').value = "";
              document.getElementById('txtNameCategory').value = "";

          }

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        
    <div id="middle" style="width : 900px;height:auto">
            <asp:Button ID="btnSearch" runat="server" Text="ReloadGrid"  onclick="btnSearch_Click"/>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
            <ContentTemplate>
            <asp:Button ID="btnAddCategory" runat="server" Text="Add Category" OnClick="btn_add_Click"/>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        ForeColor="#333333" GridLines="Horizontal"
                                ShowFooter="True" Width="100%" UseAccessibleHeader="False"
                PageSize="5"
                AllowPaging="True" style="margin-right: 0px"  OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_Paging" OnRowCommand="GridView1_RowCommand">

                <Columns>

                <asp:TemplateField HeaderText="Category" HeaderStyle-HorizontalAlign="Center" 
                    ShowHeader="False">
                
                    <ItemTemplate>
                       
         
                        <h3><asp:HyperLink ID="lnkTopic" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name")%>' NavigateUrl='<%# "~/Topic.aspx?id="+DataBinder.Eval(Container.DataItem, "IdForumCategory")%>'></asp:HyperLink></h3> <br /><%# DataBinder.Eval(Container.DataItem, "Description")%> 
                        

                    </ItemTemplate>

<HeaderStyle HorizontalAlign="center"></HeaderStyle>
                </asp:TemplateField>
               <asp:TemplateField HeaderText="Numbers Messages" HeaderStyle-HorizontalAlign="Center" 
                    ShowHeader="False">
                
                    <ItemTemplate>

                        
                       <div style="text-align:center"> <%# DataBinder.Eval(Container.DataItem, "NbMessages")%> </div>




                    </ItemTemplate>

<HeaderStyle HorizontalAlign="center"></HeaderStyle>

                </asp:TemplateField>
                               <asp:TemplateField HeaderText="Last message" HeaderStyle-HorizontalAlign="Center" 
                    ShowHeader="False">
                
                    <ItemTemplate>

                        <div style="text-align:center"> <%# DataBinder.Eval(Container.DataItem, "Date")%></div>
                
                    </ItemTemplate>

<HeaderStyle HorizontalAlign="center"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="" HeaderStyle-HorizontalAlign="Center" 
                    ShowHeader="False">
                
                    <ItemTemplate>

                        <div style="text-align:center">
                        <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="false" CommandName="" Text="Edit" ></asp:LinkButton>
                        <asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="false" CommandName="MyDelete" Text="Delete"></asp:LinkButton></div>
                       
                    </ItemTemplate>

<HeaderStyle HorizontalAlign="center"></HeaderStyle>
                </asp:TemplateField>
            </Columns>

                          <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                          <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                          <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                          <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                          <EditRowStyle BackColor="#999999" />
                          <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                 </Triggers>
        </asp:UpdatePanel>
        </div>
     




                       <asp:button id="buttonNoUse" runat="server" text="Button" style="display:none" />
                       
                        <asp:modalpopupextender id="ModalPopupExtenderDisplay" runat="server" 
	                        cancelcontrolid="ButtonEditCancel" okcontrolid="ButtonEditDone" 
	                        targetcontrolid="buttonNoUse" popupcontrolid="DivAddWindow" 
	                        popupdraghandlecontrolid="PopupHeader" drag="true" 
	                        backgroundcssclass="ModalPopupBG" BehaviorID="modalpopup"
                            OnCancelScript="EditCancelScript();" OnOkScript="EditOkayScript();">
                        </asp:modalpopupextender>

                        <asp:panel id="PanelPopup" style="display: none" runat="server">
	                        <div class="HellowWorldPopup">
                                <fieldset >
                                    <legend>Manage Article</legend>
                                        <div class="PopupHeader" id="PopupHeader">Header</div>
                                        <div class="PopupBody">
                                            <p>This is a simple modal dialog</p>
                                        </div>
                                        <div class="popup_Buttons">
                                           <input id="ButtonEditDone" value="Done" type="button" />
                                          <input id="ButtonEditCancel" value="Cancel" type="button" />
		                        </div>
                                </fieldset>
                            </div>
                        </asp:panel>


                      <div id="DivAddWindow" style="display: none;margin-left:-150px;" class="popupConfirmation">
                          <%--<iframe id="IframeEdit" frameborder="0" height="500" scrolling="no" width="800" >--%>
       <div class="popup_Container">
           <div class="popup_Titlebar" id="Div1">

               <div class="TitlebarRight" onclick="cancel();">
                  </div>

               <div class="TitlebarLeft">
<%--       <fieldset>
          <legend>Manage Article</legend>--%>
          <div class="popup_Body">
            <table id="Table1" runat="server">
                <tr>
                    <td>Name Category </td>
                     <td><asp:TextBox ID="txtNameCategory" runat="server" Text="" /> </td>
                </tr>
                <tr>
                    <td>Description </td>
                     <td> 
                        <textarea id="TxtDescCategory" cols="50" rows="10" runat="server" name="S1"></textarea>
                     </td>
                </tr>
                
                <tr>
                    <td colspan="2" style="text-align:center;">
                    <div class="popup_Buttons">
                   <asp:Button ID="BtnOk" runat="server" Text="Ok" Width="50px" OnClick="btnOkay_Click"/>
                    <input ID="BtnCancel" runat="server" value="Cancel" type="button"  onclick="cancel()"/>
                    </div>
                    </td>

                </tr>
            
            </table>
            </div>
          <%--  </fieldset>--%>
            </div>
            </div>
            </div>
                          <%--</iframe>--%>
                      </div>



                      <asp:button id="buttonNoUseEdit" runat="server" text="Button" style="display:none" />

                        <asp:modalpopupextender id="ModalPopupExtender1" runat="server" 
	                        cancelcontrolid="ButtonEditCancel" okcontrolid="ButtonEditDone" 
	                        targetcontrolid="buttonNoUseEdit" popupcontrolid="DivEditWindow" 
	                        popupdraghandlecontrolid="PopupHeader2" drag="true" 
	                        backgroundcssclass="ModalPopupBG" BehaviorID="modalpopupEdit"
                            OnCancelScript="EditCancelScript();" OnOkScript="EditOkayScript();">
                        </asp:modalpopupextender>

                        <asp:panel id="Panel1" style="display: none" runat="server">
	                        <div class="HellowWorldPopup">
                                <fieldset >
                                    <legend>Manage Article</legend>
                                        <div class="PopupHeader" id="PopupHeader2">Header</div>
                                        <div class="PopupBody">
                                            <p>This is a simple modal dialog</p>
                                        </div>
                                        <div class="popup_Buttons">
                                           <input id="Button1" value="Done" type="button" />
                                          <input id="Button2" value="Cancel" type="button" />
		                        </div>
                                </fieldset>
                            </div>
                        </asp:panel>


                      <div id="DivEditWindow" style="display: none;margin-top:-150px;margin-left:-150px;" class="popupConfirmation">
                          <iframe id="IframeEdit" frameborder="0" height="500" scrolling="no" width="800" >
                          </iframe>
                      </div>

                      

</asp:Content>
